Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function |checked_sub

std/ops/num::|checked_sub


Usage

|checked_sub<N>(a, b)

Generics

◻ N: CheckedSub

Parameters

↳ a: N
↳ b: N

Return

Option<N>


Sustract b from a, checking if overflow occurs

This function returns an option containing a - b, or none if result cause overflow in data type.